﻿package com.saint.elasticity 
{
	import com.saint.utils.Logger;
	import flash.display.Sprite;
	/**
	 * ...
	 * @author kembera
	 */
	public class ElasticProps
	{
		/* k = strength of spring; The higher k the faster the mass will come back.*/
		//private var k:Number = 0.1 ;
		
		/*	inertia relates to the quantity of energy that the spring will carry: 
		 * inertia = 1 would mean that the spring doesn't  loose any energy, 
		 * and that it will oscillate forever 	*/	 
	//	private var inertia :Number = 0.9 ;
		
		/* xp & xy stores the movement / velocity along the x-axis and y-axis
		 * this is used to calculate then 'next frames' amount of movement
		 * */
		private var xp:Number = 0;
		private var yp:Number = 0;	
			
		public function ElasticProps() 
		{
			Logger.info("ElasticProps");
		}
		
		public function calculateXMov(distance , kVal:Number = 0.1, intVal:Number = 0.9):Number
		{
			var newXp:Number =  xp * intVal + distance * kVal;			
			xp = newXp;
			return newXp;
		}	
		
		public function calculateYMov(distance, kVal:Number = 0.1, intVal:Number = 0.9):Number
		{
			var newYp:Number =  yp * intVal + distance * kVal;
			yp = newYp;
			return newYp;
		}
		
		
	}

}